<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title language="html:editUserPage"></title>
    <link rel="stylesheet" type="text/css" href="/static/common/font-awesome/css/font-awesome.min.css">
    <link rel="stylesheet" type="text/css" href="/static/common/easyui/themes/bootstrap/easyui.css">
    <link rel="stylesheet" type="text/css" href="/static/common/easyui/themes/IconExtension.css">
    <link rel="stylesheet" href="/static/common/pnotify/pnotify.custom.min.css" media="all" type="text/css" />
    <link rel="stylesheet" type="text/css" href="/static/admin/css/admin.css">
    <link rel="stylesheet" href="/static/common/animate/animate.min.css">
</head>
<body>
<form id="hm-app" type="add" action="/intendant/site/editUserSubmit">
    <input type="hidden" name="id" value="{{.user.Id}}">
    <div class="frame_form_table">
        <table cellpadding="0" cellspacing="0" class="table_form" width="100%">
            <tbody>
                <tr>
                    <td width="40" language="table:userName"></td>
                    <td width="160"><input class="easyui-validatebox length_5" name="username" value="{{.user.Username}}" data-options="required:true,validType:['englishNumeric','length[5,20]']"></td>
                </tr>
                <tr>
                    <td width="40" language="table:userPwd"></td>
                    <td width="190"><input class="easyui-validatebox length_5" type="text" name="password" id="pwd" data-options="required:true,validType:['englishNumeric','length[5,15]']"></td>
                </tr>
                <tr>
                    <td width="40" language="table:userPwdEd"></td>
                    <td width="190"><input class="easyui-validatebox length_5" type="text" name="passworded" required="required" validType="passworded['#pwd']"></td>
                </tr>
                <tr>
                    <td width="40" language="table:userNickname"></td>
                    <td width="190"><input class="easyui-validatebox length_5" type="text" name="nickname" value="{{.user.Nickname}}" data-options="required:true,validType:['nLanguageSpace','length[2,50]']"></td>
                </tr>
                <tr>
                    <td width="40" language="table:userEmail"></td>
                    <td width="190"><input class="easyui-validatebox length_5" type="text" name="email" value="{{.user.Email}}" data-options="required:true,validType:'email'"></td>
                </tr>
                <tr>
                    <td width="40" language="table:remark"></td>
                    <td width="190"><input class="easyui-validatebox length_5" type="text" name="remark" value="{{.user.Remark}}" data-options="required:true,validType:['article','length[2,255]']"></td>
                </tr>
                <tr>
                    <td width="40" language="table:userRoleGroup"></td>
                    <td width="160"><input class="select length_3" name="role" value="{{.roleme.RoleId}}"></td>
                </tr>
                <tr>
                    <td width="40" language="table:lock"></td>
                    <td width="190"><input class="switch length_5"><input type="hidden" name="status" value="{{.user.Status}}" class="easyui-validatebox" data-options="required:false,validType:['status','length[1,1]']"></td>
                </tr>
            </tbody>
        </table>
    </div>
    <div id="hm_toolbar">
        <a onclick="javascript:history.back(-1);" class="easyui-linkbutton" iconCls="icon-arrow_turn_left" plain="true" language="html:goback"></a>
        <a id="btn" href="{{.currentUrl}}" class="easyui-linkbutton" iconCls="icon-arrow_refresh" plain="true" language="html:refreshCurrent"></a>
        <a id="btn" href="javascript:void(0)" onclick="hm.ajaxAddEdit(editUserFunc,this)" class="easyui-linkbutton" iconCls="icon-edit" plain="true" language="html:ajaxEdit"></a>
    </div>
</form>
</body>
<script type="text/javascript" src="/static/common/easyui/jquery.min.js"></script>
<script type="text/javascript" src="/static/common/easyui/jquery.cookie.js"></script>
<script type="text/javascript" src="/static/common/easyui/jquery.easyui.min.js"></script>
<script type="text/javascript" src="/static/common/pnotify/pnotify.custom.min.js"></script>
<script type="text/javascript" src="/static/admin/js/language.js"></script>
<script type="text/javascript" src="/static/admin/js/global.js"></script>
<script>
var group = $.parseJSON({{.role}});
var lang = hm.getLanguage('field');
$('.select[name=role]').combobox({
    required: true,
    valueField:'id',
    textField:lang,
    editable:false,
    data: group,
    formatter:function(node){
		return node[lang];
	}
});
var st = hm.switchStatus({{.user.Status}});
$('.switch').switchbutton({
    checked: st,
    reversed: false,
    onText: hm.language.on,
    offText: hm.language.off,
    onChange: function(checked) {
        if(checked){
            $('input[name=status]').val(1);
        }else{
            $('input[name=status]').val(0);
        }

    }
});
function editUserFunc(data){
    if (data.status == 21) {
        parent.hm.notice("error", hm.language.userCheckUsername);
    } else if (data.status == 22) {
        parent.hm.notice("error", hm.language.userCheckNickname );
    } else if (data.status == 23) {
        parent.hm.notice("error", hm.language.userCheckEmail );
    } else if (data.status == 11) {
        parent.hm.notice("error", data.info);
    } else if(data.status == 12){
        parent.hm.notice("error", data.info);
    } else if(data.status == 13){
        parent.hm.notice("error", data.info);
    } else if(data.status == 14){
        parent.hm.notice("error", data.info);
    } else if(data.status == 15){
        parent.hm.notice("error", data.info);
    } else if(data.status == 16){
        parent.hm.notice("error", data.info);
    } else if(data.status == 17){
        parent.hm.notice("error", data.info);
    } else if(data.status == 18){
        parent.hm.notice("error", data.info);
    } else if(data.status == 4){
        parent.hm.notice("error", hm.language.editFailed + data.info);
    } else if(data.status == 1){
        parent.hm.notice("success", hm.language.editSuccess);
        parent.hm.refreshTab();
    }else{
        parent.hm.notice("error",hm.language.unknownError);
    }
}
</script>
</html>
